﻿using System;
using System.Collections.Generic;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NeonLampTest.Common
{
    public class BottomNode : SurroundNodeBase
    {
        public BottomNode()
        {
        }
        public override void Default()
        {
            Displacement = 1;
            X = Width;
            Y = 0;
            StartColor = EndColor = DefaultColor;
        }
        public override void Change()
        {
            X -= Step;
            if (X < 0) X = 0;
            Y = Height - SurroundWidth;
            Displacement += Step;
            if (Displacement > Width) Displacement = Width;
            ChangeEndColor();
        }

        public override void Draw(Graphics g)
        {
            Rectangle rectangle = new Rectangle(X, Y, Displacement, SurroundWidth);
            using (LinearGradientBrush bh = new LinearGradientBrush(rectangle, StartColor,  EndColor, LinearGradientMode.Horizontal))
            {
                g.FillRectangle(bh, rectangle);
            }
        }
    }
}
